package com.blb.proxy;

public class CellphoneSalesTest {

    public static void main(String[] args) {
        //被代理对象
        CellphoneSales cellphoneFactory = new CellphoneFactory();
        //JDK动态代理类对象
//        ProductProxy productProxy = new ProductProxy();
        CGLibProductProxy productProxy = new CGLibProductProxy();
        //生成代理对象
        CellphoneSales cellphoneShop = (CellphoneSales) productProxy.createProxy(cellphoneFactory);
        cellphoneShop.sellCellphone("华为P60");

        ComputerSales computerFactory = new ComputerFactory();
        ComputerSales computerShop = (ComputerSales) productProxy.createProxy(computerFactory);
        computerShop.sellComputer("苹果");

    }
}
